import platform
import psutil
# -*- coding: utf-8 -*-

###########################################################################
## Python code generated with wxFormBuilder (version Oct 26 2018)
## http://www.wxformbuilder.org/
##
## PLEASE DO *NOT* EDIT THIS FILE!
###########################################################################

import wx
import wx.xrc


###########################################################################
## Class MyFrame1
###########################################################################

class MyFrame1(wx.Frame):

    def __init__(self, parent):
        wx.Frame.__init__(self, parent, id=wx.ID_ANY, title=wx.EmptyString, pos=wx.DefaultPosition,
                          size=wx.Size(747, 643), style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)

        self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

        bSizer1 = wx.BoxSizer(wx.VERTICAL)

        bSizer1.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer2 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer2.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText1 = wx.StaticText(self, wx.ID_ANY, u"计算机名称：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText1.Wrap(-1)

        bSizer2.Add(self.m_staticText1, 0, wx.ALL, 5)

        self.m_name = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_name.Wrap(-1)

        bSizer2.Add(self.m_name, 0, wx.ALL, 5)

        bSizer2.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer2, 1, wx.EXPAND, 5)

        bSizer3 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer3.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText3 = wx.StaticText(self, wx.ID_ANY, u"计算机操作系统：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText3.Wrap(-1)

        bSizer3.Add(self.m_staticText3, 0, wx.ALL, 5)

        self.m_os = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_os.Wrap(-1)

        bSizer3.Add(self.m_os, 0, wx.ALL, 5)

        bSizer3.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer3, 1, wx.EXPAND, 5)

        bSizer4 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer4.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText5 = wx.StaticText(self, wx.ID_ANY, u"域名：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText5.Wrap(-1)

        bSizer4.Add(self.m_staticText5, 0, wx.ALL, 5)

        self.m_DNS = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_DNS.Wrap(-1)

        bSizer4.Add(self.m_DNS, 0, wx.ALL, 5)

        bSizer4.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer4, 1, wx.EXPAND, 5)

        bSizer5 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer5.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText7 = wx.StaticText(self, wx.ID_ANY, u"系统制造商：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText7.Wrap(-1)

        bSizer5.Add(self.m_staticText7, 0, wx.ALL, 5)

        self.m_manufacturer = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_manufacturer.Wrap(-1)

        bSizer5.Add(self.m_manufacturer, 0, wx.ALL, 5)

        bSizer5.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer5, 1, wx.EXPAND, 5)

        bSizer6 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer6.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText9 = wx.StaticText(self, wx.ID_ANY, u"系统型号：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText9.Wrap(-1)

        bSizer6.Add(self.m_staticText9, 0, wx.ALL, 5)

        self.m_type = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_type.Wrap(-1)

        bSizer6.Add(self.m_type, 0, wx.ALL, 5)

        bSizer6.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer6, 1, wx.EXPAND, 5)

        bSizer7 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer7.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText11 = wx.StaticText(self, wx.ID_ANY, u"处理器数：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText11.Wrap(-1)

        bSizer7.Add(self.m_staticText11, 0, wx.ALL, 5)

        self.m_numCPU = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_numCPU.Wrap(-1)

        bSizer7.Add(self.m_numCPU, 0, wx.ALL, 5)

        bSizer7.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer7, 1, wx.EXPAND, 5)

        bSizer8 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer8.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText13 = wx.StaticText(self, wx.ID_ANY, u"处理器：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText13.Wrap(-1)

        bSizer8.Add(self.m_staticText13, 0, wx.ALL, 5)

        self.m_CPU = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_CPU.Wrap(-1)

        bSizer8.Add(self.m_CPU, 0, wx.ALL, 5)

        bSizer8.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer8, 1, wx.EXPAND, 5)

        bSizer9 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer9.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText15 = wx.StaticText(self, wx.ID_ANY, u"内存：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText15.Wrap(-1)

        bSizer9.Add(self.m_staticText15, 0, wx.ALL, 5)

        self.m_mem = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_mem.Wrap(-1)

        bSizer9.Add(self.m_mem, 0, wx.ALL, 5)

        bSizer9.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer9, 1, wx.EXPAND, 5)

        bSizer10 = wx.BoxSizer(wx.HORIZONTAL)

        bSizer10.Add((0, 0), 1, wx.EXPAND, 5)

        self.m_staticText17 = wx.StaticText(self, wx.ID_ANY, u"剩余物理内存：", wx.DefaultPosition, wx.Size(150, -1), 0)
        self.m_staticText17.Wrap(-1)

        bSizer10.Add(self.m_staticText17, 0, wx.ALL, 5)

        self.m_remainMem = wx.StaticText(self, wx.ID_ANY, u"MyLabel", wx.DefaultPosition, wx.DefaultSize, 0)
        self.m_remainMem.Wrap(-1)

        bSizer10.Add(self.m_remainMem, 0, wx.ALL, 5)

        bSizer10.Add((0, 0), 1, wx.EXPAND, 5)

        bSizer1.Add(bSizer10, 1, wx.EXPAND, 5)

        bSizer1.Add((0, 0), 1, wx.EXPAND, 5)

        self.SetSizer(bSizer1)
        self.Layout()

        self.Centre(wx.BOTH)

        self.GetSysInfo()

    def __del__(self):
        pass

    def GetSysInfo(self):
        import wmi
        Wmi = wmi.WMI()
        CS = Wmi.Win32_ComputerSystem()[0]
        CPU = Wmi.Win32_Processor()[0]
        OS = Wmi.Win32_OperatingSystem()[0]

        self.m_name.SetLabel(platform.node())
        self.m_os.SetLabel(platform.system())
        self.m_DNS.SetLabel(CS.Domain)
        self.m_manufacturer.SetLabel(CS.manufacturer)
        self.m_type.SetLabel(CS.Model)
        self.m_numCPU.SetLabel(str(psutil.cpu_count()))
        self.m_CPU.SetLabel(CPU.name)
        self.m_mem.SetLabel( str(int(CS.TotalPhysicalMemory) // (1024**3)) + u"GB" )
        self.m_remainMem.SetLabel(str(int(OS.FreePhysicalMemory)//(1024**2)) + u"GB")

app = wx.App(False)
frame = MyFrame1(None)
frame.Show(True)
app.MainLoop()



